{extend name='admin@main'}
{block name="content"}
<div class="think-box-shadow">
    {include file='goods_cate/index_search'}
    <div class="layui_table_width_scroll">
        <table class="layui-table margin-top-10" lay-skin="line" >
            {notempty name='list'}
            <thead>
            <tr>
                <th class="text-left nowrap">日期</th>
                <th class='text-left nowrap'>渠道</th>
                <th class='text-left nowrap'>新增用户</th>
                {php}
                    for($i=1;$i<=$day_count;$i++){
                    echo "<th class='text-left nowrap'>".$i."天付费金额"."</th><th class='text-left nowrap'>".$i."天LTV</th>";
                    }
                {/php}
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='text-left nowrap'>{$vo.date}</td>
                <td class='text-left nowrap'>
                    {eq name='$vo.channel_name' value='0' }
                    官方-0-渠道
                    {else}
                    {$vo.channel_name}
                    {/eq}
                </td>
                <td class='text-left nowrap'>{$vo.dru}</td>
                {foreach $vo.day_amount as $day=>$amount}
                <td class='text-left nowrap'>{$amount.amount}</td>
                <td class='text-left nowrap'>{$amount.ltv}</td>
                {/foreach}
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
    <table class="layui-table margin-top-10" lay-skin="line" >
            <thead>
            <tr>
                <th class="text-left nowrap" style="padding-left: 155px;" >统计</th>
                <th class='text-left nowrap'>新增人数:<?php echo array_sum(array_column($data_arr,'dru')); ?></th>
                <th class='text-left nowrap'>付费金额:<?php echo array_sum(array_column($data_arr,'amount')); ?></th>
                <th class='text-left nowrap'>付费LTV:
                    <?php echo round(array_sum(array_column($data_arr,'amount'))/array_sum(array_column($data_arr,'dru')),2); ?>
                </th>
            </tr>
            </thead>
        </table>
    {$pages | Raw}
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}
